package com.huike.clues.service.impl;

import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.IClueTrackRecordService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * @Author: Copyright by jiyuzm
 * @Date: 2023/07/13/08:58
 * @Description: 线索跟进
 */

@Service
@AllArgsConstructor
public class ClueTrackRecordServiceImpl implements IClueTrackRecordService {

    private TbClueTrackRecordMapper clueTrackRecordMapper;


    /**
     * 新增线索跟进记录
     * @param tbClue 传入实体类
     * @param tbClueTrackRecord 传入记录
     * @param username 传入名
     */
    @Override
    public void newCliueTrackR(TbClue tbClue, TbClueTrackRecord tbClueTrackRecord, String username) {
        clueTrackRecordMapper.newClueTrackRecord(tbClue, tbClueTrackRecord, username);
    }

    /**
     * 查询线索跟进记录列表
     * @param clueId 传入线索id
     * @return List 返回查询的列表list
     */
    @Override
    public List<ClueTrackRecordVo> getList(Long clueId) {
        //根据线索id查询跟进记录列表
        List<ClueTrackRecordVo> clueTrackRecordVoList = clueTrackRecordMapper.getList(clueId);
        if (clueTrackRecordVoList != null && clueTrackRecordVoList.size() > 0) {
            return clueTrackRecordVoList;
        }
        return null;
    }

    /**
     * 获取线索跟进记录详细信息
     * @param id 传入线索ID
     * @return 返回对象
     */
    @Override
    public List<ClueTrackRecordVo> getById(Long id) {

        List<ClueTrackRecordVo> clueTrackRecordVoList = clueTrackRecordMapper.getById(id);
        if (clueTrackRecordVoList != null && clueTrackRecordVoList.size() > 0) {
            return clueTrackRecordVoList;
        } else {
            return null;
        }

    }


}
